import java.util.Arrays;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int c=n;
        boolean[] app=new boolean[n];
        int flag=1;
        while(n>0){
            flag=1;
            int m=sc.nextInt();
            sc.nextLine();
           String[] str=new String[m];
            for (int i = 0; i < str.length; i++) {
                str[i]=sc.nextLine();
            }
            Arrays.sort(str,(a,b)->Integer.compare(a.length(),b.length()));
            for (int i = 0; i < str.length-1; i++) {
                for(int j=1;j<str.length;j++){
                    String[] saa=str[j].split(str[i]);
                    if(saa.length>1&&saa[0].equals("")){
                        app[n-1]=true;
                        flag=-1;
                        break;
                    }
                }
                if(app[n-1]=true&&flag==-1){
                    break;
                }
            }
            n--;
        }
        for (int i = c-1; i >=0 ; i--) {
            if(app[i]==true){
                System.out.println("NO");
            }
            else{
                System.out.print("YES");
            }
        }
    }
}
